<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jquery的taginput</title>
    <script src="../../js/jquery-3.4.1.js"></script>
    <script src="../../js/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="../../css/jquery.tag-editor.css">
    <script src="../../js/jquery.tag-editor.js"></script>
</head>
<body>
<input type="text" id="tag_edit" />
<button id="get_all">获取全部数据</button>
</body>
<script type="text/javascript">

    let getAllButton = $('#get_all');
    let tagEditInput = $('#tag_edit');

    $(function () {
        tagEditInput.tagEditor({ initialTags: ['tag1', 'tag2', 'tag3'] });
        getAllButtonInit();
    });

    function getAllButtonInit() {
        getAllButton.on('click', function () {
            console.log(tagEditInput.val());
        })
    }

</script>
</html>